package org.androidannotations.gradle.view.model;

import org.androidannotations.annotations.EBean;
import org.androidannotations.gradle.view.adapter.AdapterData;

import java.util.List;

@EBean
public class DemoListVo implements AdapterData {

    private List<DemoListItemVo> itemList;

    public void setItemList(List<DemoListItemVo> itemList) {
        this.itemList = itemList;
    }

    public List<DemoListItemVo> getItemList() {
        return itemList;
    }

    @Override
    public int getCount() {
        if (itemList != null) {
            return itemList.size();
        }
        return 0;
    }

    @Override
    public Object getItem(int position) {
        if (itemList != null) {
            return itemList.get(position);
        }
        return null;
    }

    @Override
    public long getItemId(int position) {
        if (itemList != null) {
            DemoListItemVo item = itemList.get(position);
            if (item != null) {
                return item.getId();
            }
        }
        return 0;
    }
}
